package day03

/**
  * 类名前加private[包名]是指包访问权限，只有day03这个包有访问权限
  * 构造器参数列表前加private是指伴生对象的权限，只有伴生对象才能访问
  */
private [day03] class PrivateDemo private (val gender:Int,var faceValue:Int) {
  //字段前加private，此时该字段称为私有字段
  private val name = "jingjing"
  //对象私有字段，表示只能在本类访问
  private[this] var age = 24
  //私有方法
  private def sayHello():Unit = {
    println(s"jingjing's age is $age")
  }
}

object PrivateDemo{
  def main(args: Array[String]): Unit = {
    val privateDemo = new PrivateDemo(0,90)
    privateDemo.sayHello()
  }
}

object Test{
  def main(args: Array[String]): Unit = {
//    val privateDemo = new PrivateDemo()
//    println(privateDemo.faceValue)
  }
}
